package com.softer.chengxin.project.controller;

import com.softer.chengxin.common.domin.Common;
import com.softer.chengxin.common.domin.CommonResult;
import com.softer.chengxin.project.domin.ProfitVO;
import com.softer.chengxin.project.service.FeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Gong Zhiyang
 * @date 2018/10/17
 */
@RestController
@RequestMapping("/api/fee")
public class FeeController {
    @Autowired
    private FeeService feeService;

    /**
     * 新增经营信息
     *
     * @param profit 经营信息
     * @return 结果
     */
    @PostMapping("/add")
    public CommonResult add(ProfitVO profit) {
        return feeService.add(profit);
    }

    /**
     * 查询项目的经营信息
     *
     * @param projectId 项目ID
     * @return 项目信息
     */
    @PostMapping("/detail")
    public ProfitVO detail(String projectId) {
        return feeService.detail(projectId);
    }

    /**
     * 编辑项目经营信息
     *
     * @param profit 经营信息
     * @return 结果
     */
    @PostMapping("/edit")
    public CommonResult edit(ProfitVO profit) {
        return feeService.edit(profit);
    }
}
